/**
 * @class Ext.ux.NotificationBox
 * 
 * Creates a simple notification box at the top of the screen. Usefull for outputting debugging messages.
 * Most of the code for this was pulled from the Ext JS examples. They deserve most of the credit. I just wrapped
 * it up into an extension.
 * 
 * @version 0.01
 * @license GNU Lesser General Public License http://www.gnu.org/licenses/lgpl-3.0.txt
 * @author David Singer <david@ramaboo.com> and Ext JS
 */

Ext.namespace('Ext.ux');
Ext.ux.NotificationBox = function(){
	var msgCt;
	
	function createBox(title, body){
		return ['<div class="x-notification">',
				'<div class="x-box-tl"><div class="x-box-tr"><div class="x-box-tc"></div></div></div>',
				'<div class="x-box-ml"><div class="x-box-mr"><div class="x-box-mc"><h3>', title, '</h3>', body, '</div></div></div>',
				'<div class="x-box-bl"><div class="x-box-br"><div class="x-box-bc"></div></div></div>',
				'</div>'].join('');
	}
	
	return {
		msg: function(title, body){
			if(!msgCt){
				msgCt = Ext.DomHelper.insertFirst(document.body, {id:'x-notification'}, true);
			}
			msgCt.alignTo(document, 't-t');
			var m = Ext.DomHelper.append(msgCt, {html:createBox(title, body)}, true);
			m.slideIn('t').pause(2).ghost("t", {remove:true});
		}
	};
}();
